<script type="text/javascript"><!--//--><![CDATA[//><!--

	
    $(document).ready(function() {
        // Setup Form
		$('#form_master').setupForm([
            { name: 'kode_barang', type: 'text', size: 'medium', maxlength: 10 },
			{ name: 'nama_barang', type: 'text', size: 'long', maxlength: 100},
			{ name: 'nama_merek', type: 'text', size: 'long', maxlength: 100},
			{ name: 'spesifikasi', type: 'textarea', size:'medium', rows:3 },
			{ name: 'tipe', type: 'text', size: 'long', maxlength: 100},
			{ name: 'harga', type: 'text'},
			{ name: 'jumlah', type: 'text'},
			{ name: 'kondisi', type: 'text', size: 'long', maxlength: 100},
			{ name: 'keterangan', type: 'textarea', size:'medium', rows:3 }
        ], <?php echo json_encode($data); ?>);
        
//		f_set_combo_city_code();
		
        <?php if($mode=="edit"){ ?>
        $('#kode_barang').readonly();
		$('#nama_barang').readonly();
		$('#nama_merek').readonly();
		$('#spesifikasi').readonly();
		$('#tipe').readonly();
		$('#harga').readonly();
		$('#jumlah').readonly();
		$('#kondisi').readonly();
		$('#keterangan').readonly();
        <?php } ?>
		
		// Set Action Button
		var buttons = [{ label: 'Save', icon: 'save', onclick: function() { 
							$('#form_master').submitForm(	'/'+controller+'/ajax_post', 
															{	detail:[{ table: 'dtl_sample2', field:['index_no','ref_key_combo','ref_key_lov','jumlah','keterangan']}
																		], 
																onComplete : function(data){ eval('oData = '+data); loadPage('/'+controller+'/edit/?kode_barang='+(oData.genid!='' ? oData.genid : $('#kode_barang').getval())); }
															} 
														); 
						}},
					   { label: 'Close', icon: 'cancel', onclick: function() { loadPage('/'+controller+'/Index'); } }];
		setAction(buttons);
		
		// Create Tab
		$('#tt').tabs({ border:false });  
		
		// Focus at First Object
		$('#form_master').focusFirst();
    });
//--><!]]></script>

<div id="form_master_message" style="display:none;"></div>

<table class="tb_form" style="display:none;" cellpadding="0" cellspacing="0">
<tr>
    <td class="label">Kode Barang</td>
    <td><input id="kode_barang" /></td>
    <td class="label">Nama Merek</td>
    <td><input id="nama_merek" /></td>
</tr>
<tr>
    <td class="label">Nama Barang</td>
    <td><input id="nama_barang" /></td>
    <td class="label" rowspan="2">Spesifikasi</td>
    <td rowspan="2"><input id="spesifikasi" /></td>
</tr>
<!--<tr>
    <td class="label">Field 2 - Field 3</td>
    <td><input id="field2" />- &nbsp; <input id="field3" /></td>
    <td class="label">Field 4</td>
    <td><input id="field4" /></td> 
</tr>-->
<tr>
    <td class="label">Tipe</td>
    <td><input id="tipe" /></td>
</tr>
<tr>
    <td class="label">Harga</td>
    <td><input id="harga" /></td>
</tr>
<tr>
    <td class="label">Jumlah</td>
    <td><input id="jumlah" /></td>
</tr>
<tr>
	<td class="label">Kondisi</td>
    <td><input id="kondisi" /></td>
</tr>
<tr>
   <td class="label" rowspan="2">Keterangan</td>
    <td rowspan="2"><input id="keterangan" /></td>
</tr>
</table>

<div id="tt" class="easyui-tabs" style="min-height:400px;">  
    <div title="Turnover" style="overflow:auto;padding:10px;">  
    	<?php require_once('formdtl_sample2.php'); ?>
    </div>
    
   
</div>